package eerbaar.shared.persist.node;

import eerbaar.shared.tree.IAttributes;
import eerbaar.shared.tree.INode;
import eerbaar.shared.tree.INodeListener;
import eerbaar.shared.tree.IPayload;

public class NodeDecorator implements INode {

    private final INode node;

    public NodeDecorator(INode node) {
        assert (node != null);
        this.node = node;
    }

    @Override
    public void add(INode child) {
        this.node.add(child);
    }

    @Override
    public void addListener(INodeListener listener) {
        this.node.addListener(listener);
    }

    @Override
    public INode copy() {
        return this.node.copy();
    }

    @Override
    public IAttributes getAttributes() {
        return this.node.getAttributes();
    }

    @Override
    public INode getChild(int index) {
        return this.node.getChild(index);
    }

    @Override
    public int getChildCount() {
        return this.node.getChildCount();
    }

    @Override
    public INode[] getChildren() {
        return this.node.getChildren();
    }

    @Override
    public IPayload getPayload() {
        return this.node.getPayload();
    }

    protected INode node() {
        return this.node;
    }

    @Override
    public void remove(INode node) {
        remove(node);
    }

    @Override
    public void removeListener(INodeListener listener) {
        this.node.removeListener(listener);
    }

}
